<template>
	<view class="example">
		<uni-forms ref="baseForm" :modelValue="baseFormData">
			<uni-forms-item label="维修问题说明" required>
				<uni-easyinput type="textarea" v-model="baseFormData.description" placeholder="请输入待维修说明(出现的问题,期望的解决方式等等,不少于10字)" />
			</uni-forms-item>
			<uni-forms-item label="图片" required>
				
			</uni-forms-item>
			<uni-forms-item label="校园选择" required>
				<uni-data-checkbox v-model="baseFormData.campus" :localdata="campus" />
			</uni-forms-item>
			<uni-forms-item label="详细地址" required>
				<uni-easyinput :inputBorder="true" v-model="baseFormData.adress" placeholder="请填写详细地址" />
			</uni-forms-item>
			<uni-forms-item label="期望解决时间">
				<uni-datetime-picker type="datetime" return-type="timestamp" v-model="baseFormData.datetimesingle"/>
			</uni-forms-item>
			<uni-forms-item label="联系方式">
				<uni-easyinput v-model="baseFormData.contact"/>
			</uni-forms-item>
		</uni-forms>
		
		<button type="primary" plain="true" @click="confirm">确认</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// {}
				order: {},
				baseFormData: {
					img: [],
					campus: 0,
					description: '',
					address: '',
					contact: '',
					datetimesingle: 1627529992399
				},
				campus: [{
					text: '广州校区东校园',
					value: 0
				}, {
					text: '广州校园北校区',
					value: 1
				}, {
					text: '广州校区南校园',
					value: 2
				},{
					text: '深圳校区',
					value: 3
				},{
					text: '珠海校区',
					value: 4
				}]
			}
		},
		onLoad(options) {
			let data = JSON.parse(options.order);
			console.log(data.oid)
			this.order = data
		},
		methods: {
			submit(ref) {
				this.$refs[ref].validate().then(res => {
					console.log('success', res);
					uni.showToast({
						title: `校验通过`
					})
				}).catch(err => {
					console.log('err', err);
				})
			},
			confirm() {
				uni.navigateBack()
			}
		}
	}
</script>

<style>
	.example {
		padding: 20px;
		background-color: #fff;
	}
	.button {
		width: 60%;
	}
</style>